package org.ccahouse.ccacommons.base;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import redis.clients.jedis.JedisCluster;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author kevin
 * @version 0.1
 * @since 2020-07-03
 */

public class BaseController {


    protected HttpServletRequest request;

    protected ModelMap model;

    protected HttpServletResponse response;

    /**
     * 设置request
     *
     * @param request
     */
    @ModelAttribute
    private final void initRequest(HttpServletRequest request) {
        this.request = request;
    }

    /**
     * 设置response
     *
     * @param response
     */
    @ModelAttribute
    private final void initResponse(HttpServletResponse response) {
        this.response = response;
    }

    /**
     * 设置model
     *
     * @param model
     */
    @ModelAttribute
    private final void initModelMap(ModelMap model) {
        this.model = model;
    }

    public void print(){
        System.out.println(request.getContextPath());
    }
}
